/** @format */

import { getToday } from './utils'

// login初始化用户信息
export const initCustomUserWhenLogin = (context: IContext<IParams>, activityInfo: IActivityInfo): ICustomUserInfo => {
  return {
    isCompleteGuide: false,
    maxScore: 0,
    tools: {
      time: 1
    },
    newFetch: {
      time: 0
    },
    enterTime: Date.now()
  }
}

// login接口 更新用户时， 多用于当天第一次登陆的逻辑
export const updateUserWhenLogin = (
  context: IContext<IParams>,
  activityInfo: IActivityInfo,
  userInfo: IUserInfo
): IUpdateQuery => {
  const today = getToday()

  let projection: IUpdateQuery = {
    $inc: {}
  }

  const firstLoginToday = !userInfo?.login?.[today]

  if (firstLoginToday) {
  }
  return projection
}
